<template>
  <div class="reportMistakeInfoAction el-card is-always-shadow el-card__body">
    <el-dialog title="预览" :visible="dialogVisible" :gutter="24" @close="dialogVisible=false" width="80%">
      <div class="execution">
        <basic-container>
          <el-tabs v-model="active" type="card">
            <el-tab-pane label="配票与配备用金确认" name="1">
              <ticket-petty-add ref="1"></ticket-petty-add>
            </el-tab-pane>
            <el-tab-pane label="售票员日结算数据录入确认" name="2">
              <conductor-settle ref="2"></conductor-settle>
            </el-tab-pane>
            <el-tab-pane label="乘客事务确认" name="4">
              <passenger-work-confirm ref="4"></passenger-work-confirm>
            </el-tab-pane>
          </el-tabs>
        </basic-container>
      </div>

    </el-dialog>
  </div>
</template>


<script>
import ticketPettyAdd from "@/views/subwaystm/sw-st-watchman-confirm-info/ticket-petty-add";
import passengerWorkConfirm from "@/views/subwaystm/sw-st-watchman-confirm-info/passenger-work-confirm.vue";
import conductorSettle from "@/views/subwaystm/sw-st-watchman-confirm-info/conductor-settle.vue";
import marketingTicket from "@/views/subwaystm/sw-st-watchman-confirm-info/marketing-ticket.vue";
import {dateFormat} from "@/util/date";
export default {
  components:{
    ticketPettyAdd,
    conductorSettle,
    marketingTicket,
    passengerWorkConfirm
  },
  data() {
    return {
      active: "1",
      dialogVisible : false,
      searchForm: {
        date: dateFormat(new Date()).substr(0, 10),
        nsJobNo: "",
        nsShift: ""
      },
      stTicketPettyAdd: {},
      rStatus: {
        deviceAttribution: '1'
      },
      searchFormOption: {
        labelWidth: 100,
        submitBtn: false,
        emptyBtn: false,
        group: [
          {
            label: "",
            column: [
              {
                label: "时间",
                prop: "date",
                type: "date",
                span: 8,
                format: "yyyy-MM-dd",
                valueFormat: "yyyy-MM-dd",
                clearable: false,
                change: this.getData
              },
              {
                label: "售票员",
                prop: "nsJobNo",
                type: "select",
                span: 8,
                dicUrl: "/admin/user/page",
                props: {
                  label: "nikename",
                  value: "userCode",
                  res: "data.records"
                },
                filterable: true,
                dicQuery: {
                  size: -1
                  //TODO 过滤售票员
                },
                clearable: false,
                change: this.getData
              },
              {
                label: "班次",
                prop: "nsShift",
                type: "select",
                span: 8,
                clearable: false,
                dicUrl: "/admin/dict/type/stm_conductor_shift",
                change: this.getData
              }
            ]
          }
        ]
      }
    }
  },
  watch: {
    active() {
      this.getData();
    }
  },
  created() {

  },
  methods: {
    getData() {
      this.$nextTick(() => {
        if(
            !this.validatenull(this.searchForm.date) &&
            !this.validatenull(this.searchForm.nsJobNo) &&
            !this.validatenull(this.searchForm.nsShift)
        ){
          console.log("this.searchForm"+JSON.stringify(this.searchForm))
          this.$refs[this.active].getData(this.searchForm);
        }
      });
    },
    search(row){
      this.dialogVisible=true;
      if (row.pathType == '1') {
        this.searchForm.date = row.recordTime
      } else {
        this.searchForm.date = row.settleTime
      }
      this.searchForm.nsJobNo = row.conductorJobNo
      this.searchForm.nsShift = row.conductorShifts

      this.getData()
    },
  },
  mounted() {

  }
}
</script>
<style lang="scss">

</style>
